package com.ruoyi.project.wodemand.service.impl;

import java.util.List;

import com.ruoyi.project.wodemand.domain.TCondtionJudge;
import com.ruoyi.project.wodemand.mapper.TCondtionJudgeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wodemand.mapper.TSheetconditionsMapper;
import com.ruoyi.project.wodemand.domain.TSheetconditions;
import com.ruoyi.project.wodemand.service.ITSheetconditionsService;

import javax.annotation.Resource;

/**
 * 配置工单条件Service业务层处理
 *
 * @author lt
 * @date 2020-04-21
 */
@Service
public class TSheetconditionsServiceImpl implements ITSheetconditionsService
{
    @Resource
    private TSheetconditionsMapper tSheetconditionsMapper;
    @Resource
    private TCondtionJudgeMapper tCondtionJudgeMapper;

    /**
     * 查询配置工单条件
     *
     * @param id 配置工单条件ID
     * @return 配置工单条件
     */
    @Override
    public TSheetconditions selectTSheetconditionsById(Long id)
    {
        return tSheetconditionsMapper.selectTSheetconditionsById(id);
    }

    /**
     * 查询配置工单条件列表
     *
     * @param tSheetconditions 配置工单条件
     * @return 配置工单条件
     */
    @Override
    public List<TSheetconditions> selectTSheetconditionsList(TSheetconditions tSheetconditions)
    {
        return tSheetconditionsMapper.selectTSheetconditionsList(tSheetconditions);
    }

    /**
     * 新增配置工单条件
     *
     * @param tSheetconditions 配置工单条件
     * @return 结果
     */
    @Override
    public int insertTSheetconditions(TSheetconditions tSheetconditions)
    {
        int i = tSheetconditionsMapper.insertTSheetconditions(tSheetconditions);
        TCondtionJudge tCondtionJudge = new TCondtionJudge();
        tCondtionJudge.setCondId(tSheetconditions.getId());
        tCondtionJudge.setSheetTypeId(tSheetconditions.getSheetTypeId());
        tCondtionJudge.setLogicCode(tSheetconditions.getLogicCode());
        tCondtionJudge.setCondValueList(tSheetconditions.getReserved1());
        tCondtionJudgeMapper.insertTCondtionJudge(tCondtionJudge);
        return i;
    }

    /**
     * 修改配置工单条件
     *
     * @param tSheetconditions 配置工单条件
     * @return 结果
     */
    @Override
    public int updateTSheetconditions(TSheetconditions tSheetconditions)
    {
        return tSheetconditionsMapper.updateTSheetconditions(tSheetconditions);
    }

    /**
     * 批量删除配置工单条件
     *
     * @param ids 需要删除的配置工单条件ID
     * @return 结果
     */
    @Override
    public int deleteTSheetconditionsByIds(Long[] ids)
    {
        return tSheetconditionsMapper.deleteTSheetconditionsByIds(ids);
    }

    /**
     * 删除配置工单条件信息
     *
     * @param id 配置工单条件ID
     * @return 结果
     */
    @Override
    public int deleteTSheetconditionsById(Long id)
    {
        return tSheetconditionsMapper.deleteTSheetconditionsById(id);
    }
}
